// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: xguo

#pragma once

#include <memory>
#include <string>
#include <unordered_map>

#include "coin2/exchange/base/order/order.h"
#include "coin2/exchange/mexc/api_util/auth_key.h"
//#include "coin2/exchange/mexc_base/api_util/rate_tracker.h"

namespace coin2::exchange::mexc_futures::api_order {

class MexcFuturesNativePrivateClient : public coin2::exchange::base::order::NativePrivateClient {
 public:
  using NativeClientConfig = coin2::exchange::order::OrderConnectionConfig;
  using RestQueryProto = coin2::exchange::base::order::RestQueryProto;

 public:
  std::shared_ptr<AsioHttpContext> SubmitOrderExecution(const OrderExecutionProto& order);
  std::shared_ptr<AsioHttpContext> SubmitRestQuery(const RestQueryProto& query);

 public:
  explicit MexcFuturesNativePrivateClient(
      const MarketExchangeApi& mea,
      const NativeClientConfig& config);

  std::shared_ptr<AsioHttpContext> QueryAccountBalance();
  std::shared_ptr<AsioHttpContext> QueryAccountPosition();
  std::shared_ptr<AsioHttpContext> QueryOpenOrders();
  std::shared_ptr<AsioHttpContext> QueryAllOrders();
  std::shared_ptr<AsioHttpContext> QueryTrades(const std::string& native_symbol);
  std::shared_ptr<AsioHttpContext> PlaceOrder(const OrderSpec& order_spec, int64_t proc_order_id);
  std::shared_ptr<AsioHttpContext> CancelOrder(const std::string& exchange_order_id);
  std::shared_ptr<AsioHttpContext> PlaceOrderNorm(const OrderExecution&) override;
  std::shared_ptr<AsioHttpContext> CancelOrderNorm(const OrderExecution&) override;
};

}  // namespace coin2::exchange::mexc_futures::api_order
